package com.test.spring.utils;

import org.springframework.security.crypto.bcrypt.BCrypt;

/**
 * @Author ll
 * @Date 2017/9/29 15:45
 */
public class BCryptDemo {
    public static void main(String[] args) {
        // Hash a password for the first time
        String password = "password";
        String hashed = BCrypt.hashpw(password, BCrypt.gensalt());
        System.out.println(hashed);

        String Authenticator = "password";
        if (BCrypt.checkpw(Authenticator, hashed)) {
            System.out.println("matching...");
        } else {
            System.out.println("not match...");
        }
    }
}
